<%@ page import="com.scau.ums.model.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html class="no-js" lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>管理员主界面</title>
    <meta name="robots" content="noindex, follow" />
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Favicon -->
    <link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico">

    <!-- CSS
	============================================ -->
    <!-- google fonts -->
    <link href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,300i,400,400i,600,700,800,900%7CPoppins:300,400,500,600,700,800,900" rel="stylesheet">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="/css/bootstrapmin.css">
    <!-- Font-awesome CSS -->
    <link rel="stylesheet" href="/css/font-awesomemin.css">
    <!-- Slick slider css -->
    <link rel="stylesheet" href="/css/slickmin.css">
    <!-- animate css -->
    <link rel="stylesheet" href="/css/animate.css">
    <!-- Nice Select css -->
    <link rel="stylesheet" href="/css/nice-select.css">
    <!-- jquery UI css -->
    <link rel="stylesheet" href="/css/jqueryuimin.css">
    <!-- main style css -->
    <link rel="stylesheet" href="/css/style.css">

    <script src="/js/jquery-3.2.1min.js"></script>
    <%--"我的"按钮判断跳转--%>
    <script>
        function wodeRedirect() {
            var jsUserType = '<%=request.getSession().getAttribute("USER_TYPE")%>';
            if(jsUserType=='<%=User.ADMIN%>')
            {
                window.location.href="/adminEntrance";
            }
            if(jsUserType=='<%=User.MAINTAINER%>')
            {
                window.location.href="/maintainerEntrance";
            }
            if(jsUserType=='<%=User.STUDENT%>'||jsUserType=='<%=User.TEACHER%>')
            {
                window.location.href="/userEntrance";
            }
        }
    </script>
</head>

<body>

<header class="header-area">

    <div class="main-header d-none d-lg-block">
        <!--顶部left开始-->
        <div class="header-top black-bg">
            <div class="container">
                <!--顶部选择-->
                <div class="row align-items-center">
                    <div class="col-lg-6">
                        <div class="top-left-navigation">
                            <ul class="nav align-items-center">
                            </ul>
                        </div>
                    </div>
                    <div class="col-lg-6 d-flex justify-content-end">
                        <div class="header-social-link">
                        </div>
                        <ul class="user-info-block">
                            <!--登录开始-->
                            <%if (request.getSession().getAttribute("USER_NAME")==null){%>
                            <li><a href="/login"><i class="fa fa-sign-in"></i> 登录</a></li>
                            <%}else{%>
                            <ul class="nav">
                                <!--登录开始-->
                                <li class="mini-cart-wrap">
                                    <a href="#" class="minicart-btn">
                                        <span class="fa fa-user-circle-o"></span>
                                        <% String username=(String)request.getSession().getAttribute("USER_NAME");System.out.println(username);out.print(username);%>
                                    </a>

                                    <!--两个按钮开始-->
                                    <div class="cart-list-wrapper">
                                        <div class="minicart-button">
                                            <a onclick="wodeRedirect()"><i class="fa fa-user-plus"></i> 我的</a>
                                            <a href="/logout"><i class="fa fa-user-times"></i> 注销</a>
                                        </div>
                                    </div>
                                    <!--两个按钮结束-->
                                </li>
                                <!--登录结束-->
                            </ul>
                            <%}%>
                            <!--登录结束-->
                        </ul>
                    </div>
                </div>
            </div>
        </div>

        <!--顶部left结束-->

        <div class="header-main-area black-soft sticky">
            <div class="container">
                <div class="row align-items-center position-relative">
                    <!-- logo展示开始 -->
                    <div class="col-auto">
                        <div class="logo">
                            <a href="/">
                                <img src="/img/2.jpg" style="margin-bottom:58px" alt="Brand Logo">
                            </a>
                        </div>
                    </div>
                    <!-- logo展示结束 -->
                    <div class="col-auto position-static">
                        <div class="main-menu-area">
                            <div class="main-menu">
                                <!-- 标签栏开始 -->
                                <nav class="desktop-menu">
                                    <ul>
                                        <li class="active"><a href="/adminEntrance">主页 <i class="fa fa-angle-left"></i></a>
                                        </li>
                                        <li><a href="/adminEntrance">管理模块 <i class="fa fa-angle-down"></i></a>
                                            <ul class="dropdown">
                                                <li><a href="publishNews">发表新闻 <i class="fa fa-plus"></i></a>
                                                </li>
                                                <li><a href="GetverifySuggestions">言论管理 <i class="fa fa-twitch"></i></a>
                                                </li>
                                                <li><a href="verifyLostAndFound">失物招领审核 <i class="fa fa-gratipay"></i></a>
                                                </li>
                                                <li><a href="listUser">用戶管理与数据中心 <i class="fa fa-user-plus"></i></a>
                                                </li>
                                            </ul>
                                        </li>

                                    </ul>
                                </nav>
                                <!-- 标签栏结束 -->
                            </div>
                        </div>
                    </div>


                </div>
            </div>
        </div>


    </div>


</header>

<script>
    <%--$.post("${pageContext.request.contextPath}/showlist",{},function(data){--%>
    <%--alert("success");--%>
    <%--document.getElementById("lostThing").innerHTML = data.getKey("itemName");--%>
    <%--});--%>
    $.ajax({
        url:"/verifySuggestionslist",
        contentType:"application/json;charset=UTF-8",
        data:{},
        type:"post",
        success:function (data) {
            $(".verifySuggestionslist").empty();
            var htm="<!-- 第一个table -->\n" +"<div>"+
                "    <table class=\"cloudTable cloudMtxTableHead\">\n" +
                "      <colgroup>\n" +
                "        <col width=\"330px\">\n" +
                "        <col width=\"330px\">\n" +
                "        <col width=\"330px\">\n" +
                "        <col width=\"48px\">\n" +
                "        <col width=\"48px\">\n" +
                "      </colgroup>\n" +
                "      <thead class=\"cloudTable_header\">\n" +
                "        <tr>\n" +
                "          <th>建议提出者</th>\n" +
                "          <th>建议内容</th>\n" +
                "          <th>时间</th>\n" +
                "          <th>操作</th>\n" +
                "          <th style=\"width: 48px;\"></th>\n" +
                "        </tr>\n" +
                "      </thead>\n" +
                "    </table >";
            for(var p in data){//遍历json对象的每个key/value对,p为key

                //document.getElementById("itemname").innerHTML = data[p].itemname;

                htm+="<div class=\"cloudMtxTable_body\">\n" +
                    "      <table class=\"cloudTable\"  style=\"table-layout:fixed\">\n" +
                    "        <colgroup >\n" +
                    "          <col width=\"330px\">\n" +
                    "          <col width=\"330px\">\n" +
                    "          <col width=\"330px\">\n" +
                    "        <col width=\"48px\">\n" +
                    "        <col width=\"48px\">\n" +
                    "        </colgroup>\n" +
                    "        <tbody class=\"cloudTable_body \">\n" +
                    "          <tr>\n" +
                    "            <td>"+data[p].speakername+"</td>\n" +
                    "            <td>"+data[p].content+"</td>\n" +
                    "            <td>"+new Date(data[p].date).Format("yyyy-MM-dd:hh:mm:ss")+"</td>\n" +
                    "          <th><button class=\'passbtn\' onclick=\""+"pass("+p+")"+"\">通过</button></th>\n" +
                    "          <th><button class=\'rejectbtn\' onclick=\""+"reject("+p+")"+"\">拒绝</button></th>\n" +
                    "          </tr>   \n" +
                    "        </tbody>\n" +
                    "      </table>\n" +
                    "    </div>"+
                    "</div>";




            }
            $(".verifySuggestionslist").append(htm);
        },
        error:function () {
            alert("failed");
        }
    })

    Date.prototype.Format = function(fmt) {
        var o = {
            "M+" : this.getMonth() + 1, // 月份
            "d+" : this.getDate(), // 日
            "h+" : this.getHours(), // 小时
            "m+" : this.getMinutes(), // 分
            "s+" : this.getSeconds(), // 秒
            "q+" : Math.floor((this.getMonth() + 3) / 3), // 季度
            "S" : this.getMilliseconds()
            // 毫秒
        };
        if (/(y+)/.test(fmt))
            fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "")
                .substr(4 - RegExp.$1.length));
        for ( var k in o)
            if (new RegExp("(" + k + ")").test(fmt))
                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k])
                    : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;

    };
    function pass(passid) {
        $.ajax({
            url:"/verifySuggestionslist?passid="+passid,
            contentType:"application/json;charset=UTF-8",
            data:{},
            type:"post",
            success:function (data) {
                //alert("===================")
                location.reload();

            },
            error:function () {
                alert("审核出现错误");
            }
        })
    };
    function reject(rejectid) {
        $.ajax({
            url:"/verifySuggestionslist?rejectid="+rejectid+" ",
            contentType:"application/json;charset=UTF-8",
            data:{},
            type:"post",
            success:function (data) {
                location.reload();
            },
            error:function () {
                alert("拒绝失败");
            }
        })
    };

    $(document).ready(function(){
        $('head').append('<link href="/css/verifySuggestions.css" rel="stylesheet" type="text/css" />');
        var $button = document.querySelector('.button');
        $button.addEventListener('click', function() {
            var duration = 0.3,
                delay = 0.08;
            TweenMax.to($button, duration, {scaleY: 1.6, ease: Expo.easeOut});
            TweenMax.to($button, duration, {scaleX: 1.2, scaleY: 1, ease: Back.easeOut, easeParams: [3], delay: delay});
            TweenMax.to($button, duration * 1.25, {scaleX: 1, scaleY: 1, ease: Back.easeOut, easeParams: [6], delay: delay * 3 });
        });
        // var btns=$("button").css({
        //     "width": "48px", /* 宽度 */
        // "height": "40px", /* 高度 */
        // "border-width": "0px", /* 边框宽度 */
        // "border-radius": "3px", /* 边框半径 */
        // "background": "#1E90FF", /* 背景颜色 */
        // "cursor": "pointer", /* 鼠标移入按钮范围时出现手势 */
        // "outline": "none", /* 不显示轮廓线 */
        // "font-family": "Microsoft YaHei", /* 设置字体 */
        // "color": "white", /* 字体颜色 */
        // "font-size": "17px" /* 字体大小 */
        // });
        // btns.attr({
        //     rel: "stylesheet",
        //     type: "text/css",
        //     href:  "statics/css/verifySuggestions.css"
        // })
    });


</script>


<%--审核列表显示--%>

<main>
    <div class="blog-main-wrapper section-padding" >
        <div class="container">
            <div class="row">
                <div class="myaccount-content blog-comment-wrapper" style="height: 500px;">
                    <h5>未审核建言献策列表</h5>
                    <div class="verifySuggestionslist" style="height: 70%;overflow: auto">

                    </div>
                </div>
            </div>
        </div>
    </div>

</main>

<!-- footer area start -->
<footer class="black-bg">
    <div class="footer-middle-area">
        <div class="container">
            <div class="row mtn-30">
                <div class="col-lg-6 col-sm-12">
                    <div class="address-block mt-30">
                        <div class="footer-logo">
                            <a href="#">
                                <img src="/img/2.jpg" alt="Brand Logo">
                            </a>
                        </div>
                        <address class="address-info d-flex align-items-center">
                            <i class="fa fa-map-marker"></i>
                            <p><span>ADDRESS : </span> 梦翔大厦</p>
                        </address>
                    </div>
                </div>
                <div class="col-lg-3 col-sm-6">
                    <address class="address-info email mt-30">
                        <i class="fa fa-envelope"></i>
                        <p><span>EMAIL : </span><a href="#">xxxx@qq.com</a></p>
                    </address>
                </div>
                <div class="col-lg-3 col-sm-6">
                    <address class="address-info email mt-30">
                        <i class="fa fa-phone"></i>
                        <p><span>PHONE : </span><a href="#">158xxxxx9442</a></p>
                    </address>
                </div>
            </div>
        </div>
    </div>
    <div class="footer-bottom-area text-center">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <div class="payment-method-list">

                    </div>

                    <p class="copyright">
                        Copyright © www.xxx.com
                    </p>
                </div>
            </div>
        </div>
    </div>
</footer>
<!-- footer area end -->



<!-- JS
============================================ -->

<!-- Modernizer JS -->
<script src="/js/modernizr-3.6.0min.js"></script>
<!-- jQuery JS -->
<script src="/js/jquery-3.3.1min.js"></script>
<!-- Popper JS -->
<script src="/js/poppermin.js"></script>
<!-- Bootstrap JS -->
<script src="/js/bootstrapmin.js"></script>
<!-- slick Slider JS -->
<script src="/js/slickmin.js"></script>
<!-- Countdown JS -->
<script src="/js/countdownmin.js"></script>
<!-- Nice Select JS -->
<script src="/js/nice-selectmin.js"></script>
<!-- jquery UI JS -->
<script src="/js/jqueryuimin.js"></script>
<!-- Image zoom JS -->
<script src="/js/image-zoommin.js"></script>
<!-- image loaded js -->
<script src="/js/imagesloadedpkgdmin.js"></script>
<!-- masonry  -->
<script src="/js/masonrypkgdmin.js"></script>
<!-- mailchimp active js -->
<script src="/js/ajaxchimp.js"></script>
<!-- contact form dynamic js -->
<script src="/js/ajax-mail.js"></script>
<!-- google map api -->
<script src="http://ditu.google.cn/maps/api/js?key=AIzaSyCfmCVTjRI007pC1Yk2o2d_EhgkjTsFVN8"></script>
<!-- google map active js -->
<script src="/js/google-map.js"></script>
<!-- Main JS -->
<script src="/js/main.js"></script>
</body>

</html>